package com.letoo.dragon.common.exception;

import java.util.HashMap;
import java.util.Map;

import com.letoo.dragon.common.domain.ResultCode;

/**
 * 系统异常类，整个系统只保留业务异常和系统异常两种异常类别
 * 
 * @author dengjie
 *
 */
public class SystemException extends RuntimeException {

    /**
	 * 
	 */
	private static final long serialVersionUID = -2066096959770785406L;

	/**
     * 自定义属性
     */
    private Map<String, Object> resultMap = new HashMap<String, Object>();

    private ResultCode code;

    public SystemException(String message) {
        super(message);
    }

    public SystemException(Throwable cause) {
        super(cause);
    }

    public SystemException(String message, Throwable cause) {
        super(message, cause);
    }

    public SystemException(String message, Map<String, Object> resultMap) {
        super(message);
        this.resultMap = resultMap;
    }

    public SystemException(ResultCode code, String message) {
        super(message);
        this.code = code;
    }

    public SystemException(ResultCode code) {
        super(code.getDescription());
        this.code = code;
    }

    public SystemException(String message, Map<String, Object> resultMap, Throwable cause) {
        super(message, cause);
        this.resultMap = resultMap;
    }

    public Map<String, Object> getResultMap() {
        return resultMap;
    }

    public ResultCode getCode() {
        return code;
    }

}
